<template>
 <view>
    <view class="list-item">
		<view class="info">
			<textarea 
				:value="formData.reason"
				maxlength="150"  rows="2" cols="50"
				placeholder-class="text"
				placeholder="在你减肥期间你还想要什么样的功能来帮助自己在减肥呢?&#13;&#10;&#10;请你说说你的想法,您的意见非常宝贵!"
				@input="bindTextAreaInput"/>
		</view>
    </view>
    	<button class="submit1"  @click="formSubmit()">提交</button>
 </view>
</template>


<script>
	import store from 'store';
	import {is_login} from '@/pages/login/login.js';
	export default{
		data(){
			return{
				formData:{
					reason:""
				}
			}
		},
		methods:{
			bindTextAreaInput: function (e) {
				this.formData.reason = e.detail.value;
			},
			formSubmit(){
				var new_function = this.formData.reason;
				if( new_function == "" || new_function ==null){
					uni.showToast({
							icon:'none',
							title:'请填入您的意见！',
							duration: 3000
						})
				}else{
					console.log('表单',new_function);
			   let token = uni.getStorageSync('token');
			   uni.request({
			 	url:store.state.URL+"rwd/login_user/new_function", 
				data:{
					token,
					new_function,
				},
				success(res) {
					console.log(res)
					is_login(res);
					if(res.data.msg == "Token不可用") res.data.msg = '请先登录';
					uni.showToast({
						icon:'none',
						title:res.data.msg,
						duration: 1000
					})
				},
				fail() {
					console.log('newFunction失败');
					uni.showToast({
						icon:'none',
						title:'提交失败',
						duration: 1000
					})
				}
			 })
				}
			},
			}
  
	}
</script>

<style>
	*{
		margin: 0 auto;
		padding: 0px;
	}
	.bg{
		width: 100%;
	}
 .list-item{
	background: #FFFFFF;
	margin: 30upx 30upx 0upx 30upx;
	font-family:苹方,regulal;
	height: 318upx;
	border: 1px solid #FFFFFF;
	color: #999999;
 }
 .info{
	margin: 36upx 36upx 30upx 30upx;
	border: 1upx solid #FFFFFF;  
 }
 textarea{
	 height: 270upx;
 }
 .text{
  font-size: 32upx;
  color: #999999;
  font-family:苹方,regulal;
  line-height: 20upx;
 }
 .submit1{
	 margin-top:88upx ;
	 background-color: #FE827B;
	 height: 88upx;
	 width: 656upx;
	 font-size:36upx;
	 border-radius: 10upx;
	 color:#FFFFFF;
	 font-family: 苹方,regular;
 }
 .submit1:after{
	 border: none;
 }
</style>